/**
 * Created by waterworld on 17-7-22.
 */
var robots=function()
{
    var list=[
        {uid:100,name:'小怪兽',cardNum:10000,online:false,loginType:'debug'},
        {uid:101,name:'汪星人',cardNum:10000,online:false,loginType:'debug'},
        {uid:102,name:'smart',cardNum:10000,online:false,loginType:'debug'},
        {uid:103,name:'MiUI',cardNum:10000,online:false,loginType:'debug'},
        {uid:104,name:'天空',cardNum:10000,online:false,loginType:'debug'},
        {uid:105,name:'达康书记',cardNum:10000,online:false,loginType:'debug'}
    ];
    this.users=[];
    var imgs=['http://imgcache.g9527.com/006agRusjw8f7q0bgbyuqj30ro0rpwg5.jpg',
        'http://imgcache.g9527.com/006kSXONjw8fbq08uqailj30ig0ig415.jpg',
        'http://imgcache.g9527.com/006zfdGjjw8fbhfdiu28zj30hs0h4gmb.jpg',
        'http://imgcache.g9527.com/006BFxhFjw8fbtougnc1qj30ig0igjs1.jpg',
        'http://wx.qlogo.cn/mmopen/Q3auHgzwzM6kDVeSZUh7dnUVZngepiaiaS9UvsRG9fzwGGVe6yra5tzEZzQRQCzBFJT9GlQhrl4cyFP61CMIicSZ7kZZy1Tnq11TfWN9KkmiaxY/0'
    ];
    for(var i=0;i<1000;i++)
    {   //var it=util.clone(list[i%6]);
        var it=list[i%6];
        it.name=it.name+i;
        it.uid=it.uid+i;
        it.headimgurl=imgs[i%5];
        it.cdnImgurl=it.headimgurl;
        it.i=i;
        it.sex='man';
        this.users.push(it);
    }
    return this;
}
robots.prototype.getRobot=function()
{
    for(var i=0;i<1000;i++)
    {   var user=this.users[i];
        if(user.online==false)
        {  user.online=true;
            user.i=i;
            return user; }
    }
    return null;
}
robots.prototype.robotOffline=function(robot)
{
    if(!robot) return;
    var i=robot.i;
    this.users[i].online=false;
}

module.exports=robots;